package mediator;

public class Mediator {
    private Man man;
    private Woman woman;

    public void setMan(Man man) {
        this.man = man;
    }

    public void setWoman(Woman woman) {
        this.woman = woman;
    }

    public void getPartner(Person person) {
        if (person instanceof Man) {
            this.setMan((Man) person);
        } else {
            this.setWoman((Woman) person);
        }
        if (man.getLevel() == woman.getLevel()) {
            System.out.println(man.getName() + "和" + woman.getName() + ":绝配");
        } else {
            System.out.println(man.getName() + "和" + woman.getName() + ":不相配");
        }

    }
}
